<?php
header('Content-Type: text/html; charset=UTF-8');
require 'database.php';
$db = new DB();

$Qry = 'SELECT DISTINCT(parrent)
		FROM cat
		ORDER BY parrent';
$row = $db->fetchAll($Qry);

echo '<ul>';
foreach ($row as $key=>$value) {
	echo '<li>' . ($key + 1) . ' - <a href="get-link-games.php?c=' . $value['parrent'] . '" target="_blank">' . $value['parrent'] . '</a></li>';
}
echo '</ul>';

echo '<br />';

$Qry = 'SELECT *
		FROM cat
		ORDER BY parrent ASC, name ASC';
$res = $db->fetchAll($Qry);

echo '<ul>';
foreach ($res as $key=>$value) {
	echo '<li>' . ($key + 1) . ' - <a href="get-link-games.php?parrent=' . $value['parrent'] . '&c=' . $value['url'] . '" target="_blank">' . $value['parrent'] . ' > ' . $value['name'] . '</a></li>';
}
echo '</ul>';